<?php
include('../../inc/global.inc');
$url="news_type.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
<?php
//删除信息
if($_GET['del_act']){
$urls=$_SERVER['HTTP_REFERER'];
mysql_query("delete from job_news_type where id='".$_GET['del_id']."'");
echo "<script>alert('删除成功');location='".$urls."';</script>";
}?>
  <table width="70%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">招聘资讯分类&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
  <table width="70%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
    <tr>
      <td height="2"></td>
    </tr>
  </table>
  <table width="70%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td width="15%" height="30" align="center" bgcolor="#8DA8CF">编号</td>
      <td width="32%" align="center" bgcolor="#8DA8CF"><span class="category">分类名称</span></td>
      <td width="22%" align="center" bgcolor="#8DA8CF">配置</td>
      <td width="31%" align="center" bgcolor="#8DA8CF"><a href="news_type_modify.php?tj=ok&id=<?=$_GET[id]?>">添加新分类</a></td>
    </tr>
<?php
if($_GET[id]){
$sql="select * from  job_news_type  where job_t_id='".$_GET['id']."' order by id asc limit ".($thepage-1)*$maxpage.",$maxpage";
$sqls="select * from  job_news_type  where job_t_id='".$_GET['id']."'";
}else
{
$sql="select * from  job_news_type where job_t_id=0 order by id asc limit ".($thepage-1)*$maxpage.",$maxpage";
$sqls="select * from  job_news_type where job_t_id=0";
}
$rs=mysql_query($sql);
$i=1;
while ($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
//记录下级目录
$rs2=mysql_query("select * from job_news_type where job_t_id='".$row['id']."'");
$num=mysql_num_rows($rs2);
?>
   <tr bgcolor="<?=$color?>">
     <td height="25" align="center"><?=$i?></td>
	 <td height="25" align="left" style="padding-left:10px;"><a href="<?=$url?>?id=<?=$row['id']?>" style="text-decoration:underline;"><?=$row[job_t_name]?>[<font color="red"><?=$num?></font>]</a></td>
	 <td height="25" align="center" style="padding-left:10px;"><?=$row[job_t_ping]?></td>
	 <td height="25" align="center"><a href="news_type_modify.php?xg=ok&xg_id=<?=$row['id']?>">编辑</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<?=$url?>?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">删除</a></td>
   </tr>
<?php
	$i++;}
?>
<?php
$totalrecord=mysql_num_rows(mysql_query($sqls));
$totalpage=ceil($totalrecord/$maxpage);
?>
   <tr>
      <td height="25" colspan="4" align="center" bgcolor="#FFFFFF">
   <form method="get" action="<?=$url?>?id=<?=$_GET[id]?>"><?php
   if($thepage>1){
   ?><a href="<?=$url?>?id=<?=$_GET[id]?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>&id=<?=$_GET[id]?>">上一页</a>&nbsp;
   <?php
   };
   if($thepage!=$totalpage&&$totalpage>1){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>&id=<?=$_GET[id]?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>&id=<?=$_GET[id]?>">最后一页</a>
   <?php
   };?>【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条】【共<font color="red"><?=$totalpage?></font>页】<input type="text" size="3" name="page" onKeyUp="IsDigit(this)">&nbsp;<input type="submit" value="Go"></form>      </td>
   </tr>
  </table>
</center>
</BODY>
</HTML>

<script language="javascript">
function IsDigit(obj) 
{ 
if(obj.value.replace(/[\d+]/ig,"").length>0) { 
  alert('请输入数字'); 
  document.getElementById(obj).value =""; 
} 
} 
</script>